﻿Public Class FShowPairUpTicket
    Private mBuddy As Entities.Buddy

    Public Shadows Sub ShowDialog(ByVal owner As IWin32Window, ByVal buddy As Entities.Buddy)
        mBuddy = buddy
        Me.Text = String.Format(Me.Text, mBuddy.NameLocal)
        Me.Icon = Framework.My.Resources.Buddy
        txtBuddyNr.Text = buddy.Id.ToString
        txtPinCode.Text = buddy.PairUpPinCode
        txtHost.Text = Framework.Net.Settings.Host
        txtPort.Text = Framework.Net.Settings.Port.ToString
        txtValidUntil.Text = buddy.PairUpValidUntil.ToString("g"c)
        MyBase.ShowDialog(owner)
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim clsSB As New System.Text.StringBuilder
        clsSB.Append("Buddy#:")
        clsSB.AppendLine(mBuddy.Id.ToString)
        clsSB.Append("PinCode:")
        clsSB.AppendLine(mBuddy.PairUpPinCode)
        clsSB.Append("Host:")
        clsSB.AppendLine(Framework.Net.Settings.Host)
        clsSB.Append("Port:")
        clsSB.AppendLine(Framework.Net.Settings.Port.ToString)
        Clipboard.Clear()
        Clipboard.SetText(clsSB.ToString)
        MessageBox.Show(Me, "Pair up ticket copied to clipboard", "Pair Up")
    End Sub
End Class